package com.lecture.service.impl;

import java.util.List;
import java.util.Set;

import com.lecture.hibernate.pojo.FileInfo;
import com.lecture.hibernate.pojo.Student;
import com.lecture.service.FileInfoService;
import com.lecture.view.util.ViewUtils;
import com.lecture.hibernate.pojo.FileInfoDAO;
public class FileInfoServiceImpl implements FileInfoService {
	private FileInfoDAO fileInfoDao;
	public void setFileInfoDAO(FileInfoDAO dao)
	{
		this.fileInfoDao = dao;
	}
	public FileInfoDAO getFileInfoDAO()
	{
		return this.fileInfoDao;
	}
	public List<FileInfo> findFileInfoByStudent(Student student)
			throws Exception {
		// TODO Auto-generated method stub
		Set set = student.getFileInfos();
		List list = ViewUtils.convertToList(set);
		return list;
	}

	public boolean saveFileInfo(FileInfo fileInfo) throws Exception {
		// TODO Auto-generated method stub
		fileInfoDao.save(fileInfo);
		return true;
	}
	public boolean updateFileInfo(FileInfo fileInfo)throws Exception{
		fileInfoDao.merge(fileInfo);
		return true;
	}
}
